function createTime(ctimeMs) {
    var date1 = new Date(ctimeMs);
    var year = date1.getFullYear();
    var month = date1.getMonth() + 1;
    var day = date1.getDate();
    var hour = date1.getHours();
    var minute = date1.getMinutes();
    return year+'-'+month+'-'+day+' '+hour+':'+minute;
}

const fs = require("fs");
const path = require("path");

var filePath = path.join(__dirname, "/1.txt");

var fileObj = fs.statSync(filePath); //获取文件相关属性的信息
// console.log(fileObj);
var ctimeMs = fileObj.ctimeMs;
console.log(createTime(ctimeMs)); // 2021-9-15 8:22 文件创建时间

// var date1 = new Date(ctimeMs);
// console.log(date1.getFullYear());